package com.henu.action;

import java.io.IOException;
import java.util.Enumeration;
import java.util.Map;

import org.smart4j.framework.mvc.DataContext;
import org.smart4j.framework.mvc.annotation.Action;
import org.smart4j.framework.mvc.annotation.Request;
import org.smart4j.framework.mvc.bean.Result;


@Action
public class ProductAction {
    
    @Request("POST:/Product/GetSearchProduct")
    public Result getSearchProduct(Map<String, Object> fieldMap) {

        //System.out.println(request.getParameterNames());
        Enumeration e = DataContext.getRequest().getParameterNames();
        Enumeration a = DataContext.getRequest().getHeaderNames();
        print(a);
        print(e);
        byte[] bb = new byte[1024];
        try {
            DataContext.getRequest().getInputStream().read(bb);
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        System.out.println(new String(bb));
        return new Result(true).data("asdf");
    }

    private void print(Enumeration a) {
        while (a.hasMoreElements()) {
            System.out.println(a.nextElement());
        }
        System.out.println("***************************");

    }

}
